import request from '@/utils/request.js'

// 获取库存概览数据
export const getInventoryOverview = () => {
    return request.get('/stats/overview')
}

// 获取库存前十的商品数据
export const getTopTen = () => {
    return request.get('/stats/topInventory')
}

// 获取商品分类占比
export const getGoodsType = (timeRange = 'month') => {
    return request.get('/stats/categoryProportion', {
        params: {
            timeRange // week-本周 month-本月 year-全年
        }
    })
}

// 获取库存变化趋势
export const getInventoryTrend = (params) => {
    return request.get('/stats/trend', {
        params: {
            type: params.type,  // in-入库 out-出库
            startTime: params.startTime,
            endTime: params.endTime
        }
    })
}